import java.util.Scanner;

public class HomeWork07_07{
    static int func(int itger, int n){
        int ans = 0;
        while(n-- > 0){
            ans += itger % 10;
            itger /= 10;
        }
        return ans;
    }
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        System.out.print("please enter an 4-digits integer: ");
        int itger = scan.nextInt();
        
        System.out.println("各个位上的数字之和为: " + func(itger, 4));
    }
}